package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FitSleepMapper;
import com.ruoyi.system.domain.FitSleep;
import com.ruoyi.system.service.IFitSleepService;
import com.ruoyi.common.core.text.Convert;

/**
 * 睡眠记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-14
 */
@Service
public class FitSleepServiceImpl implements IFitSleepService 
{
    @Autowired
    private FitSleepMapper fitSleepMapper;

    /**
     * 查询睡眠记录
     * 
     * @param id 睡眠记录主键
     * @return 睡眠记录
     */
    @Override
    public FitSleep selectFitSleepById(Long id)
    {
        return fitSleepMapper.selectFitSleepById(id);
    }

    /**
     * 查询睡眠记录列表
     * 
     * @param fitSleep 睡眠记录
     * @return 睡眠记录
     */
    @Override
    public List<FitSleep> selectFitSleepList(FitSleep fitSleep)
    {
        return fitSleepMapper.selectFitSleepList(fitSleep);
    }

    /**
     * 新增睡眠记录
     * 
     * @param fitSleep 睡眠记录
     * @return 结果
     */
    @Override
    public int insertFitSleep(FitSleep fitSleep)
    {
        fitSleep.setCreateTime(DateUtils.getNowDate());
        return fitSleepMapper.insertFitSleep(fitSleep);
    }

    /**
     * 修改睡眠记录
     * 
     * @param fitSleep 睡眠记录
     * @return 结果
     */
    @Override
    public int updateFitSleep(FitSleep fitSleep)
    {
        fitSleep.setUpdateTime(DateUtils.getNowDate());
        return fitSleepMapper.updateFitSleep(fitSleep);
    }

    /**
     * 批量删除睡眠记录
     * 
     * @param ids 需要删除的睡眠记录主键
     * @return 结果
     */
    @Override
    public int deleteFitSleepByIds(String ids)
    {
        return fitSleepMapper.deleteFitSleepByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除睡眠记录信息
     * 
     * @param id 睡眠记录主键
     * @return 结果
     */
    @Override
    public int deleteFitSleepById(Long id)
    {
        return fitSleepMapper.deleteFitSleepById(id);
    }
}
